﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using IdentityModel;
using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Test;

namespace Idp_Login
{
    public partial class Config 
    {
      
        /// <summary>
        /// 内置用户( In memory 模式)
        /// </summary>
        /// <returns></returns>
        public static List<TestUser> GetUsers()
        {
            var users = new List<TestUser>();

            users.Add(new TestUser()
            {
                //内置 给  02密码认证ResourceOwnerPassword 使用
                SubjectId = "13",
                Username = "root",
                Password = "root",
                IsActive = true,
                Claims = new List<Claim>()
                {
                    new Claim("fax","778"),
                    new Claim("carBrand","mbw"),
                    new Claim("email","email_root"),
                    new Claim(JwtClaimTypes.Role,"admin"),
                    new Claim(JwtClaimTypes.Role,"superadmin")
                }
            });
            users.Add(new TestUser()
            {
                SubjectId = "11",
                Username = "alice",
                Password = "password",
                IsActive = true,
                Claims = new List<Claim>()
                {
                    new Claim("fax","778"),
                    new Claim("carBrand","mbw"),
                    new Claim("email","email123"),
                }

            });
            users.Add(new TestUser
            {
                SubjectId = "12",
                Username = "bob",
                Password = "password",
                IsActive = false,
                Claims = new List<Claim>()
                {
                    new Claim("email","email456"),
                    new Claim("carBrand","BenTian"),
                    new Claim("water","wahaha"),
                }
            });

            return users;
        }
  
    }
}
